<h1>Product Description</h1>

<div class="toolbar">
    <div id="tLeft"><?php echo $this->element('toolbar', array('buttons' => array(
        array('back' => array('params' => $customer_id . '/' . $site_id . '/supplier_id:' . $supplier_id))
        ))); ?></div>
    <div id="tRight"><?php echo $this->element('neighbors', array('model' => 'CustProductSite', 'title' => 'stock_code')); ?></div>
</div>

<fieldset>
    <legend>General Information</legend>
    <table class="wide">
        <tr>
            <td width="130px"><?php echo $form->label('CustProductSite.stock_code') ;?></td>
            <td width="350px" align="left"><?php echo $this->data['CustProductSite']['stock_code'] ?></td>
            <td width="150px"><?php echo $form->label('Product.part_no', 'Vendor Part no.') ;?></td>
            <td><?php echo $this->data['Product']['supplier_part_no']; ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.category_id') ;?></td>
            <td><?php echo isset($this->data['Product']['Category']['name'])? $this->data['Product']['Category']['name'] : '-' ?></td>
            <td><?php echo $form->label('CustProductSite.dispatch_from', 'Vendor') ;?></td>
            <td><?php echo $this->data['Supplier']['name']; ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('Product.model') ;?></td>
            <td><?php echo $this->data['Product']['model'] ?></td>
            <td><?php echo $form->label('Product.brand_id') ;?></td>
            <td><?php echo $this->data['Product']['Brand']['name'] ?></td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('Product.title', 'Title') ;?></td>
            <td><?php echo $this->data['Product']['title'] ?></td>
            <td><?php echo $form->label('Product.cost') ;?></td>
            <td><?php echo number_format($this->data['Product']['cost'], 2); ?> Baht</td>
        </tr>
        <tr>
            <td class="top"><?php echo $form->label('Product.text', 'Description') ;?></td>
            <td>
                <?php echo !empty($this->data['CustProductSite']['text'])?
                $this->data['CustProductSite']['text']:
                $this->data['Product']['text']; ?>
            </td>
            <td><?php echo $form->label('CustProductsite.latest_price') ;?></td>
            <td>
                <?php echo number_format($this->data['CustProductSite']['price'], 2); ?> Baht
                <?php echo $ajax->link($html->image('icon/popup.png', array('title' => 'Price History')),
                                        array('controller' => 'its_cust_product_sites', 'action' => 'popup_view_price', $this->data['CustProductSite']['id'], true),
                                        array('update' => 'content', 'position' => 'bottom', 'indicator' => 'indicator'), null, false);
                ?>
            </td>
        </tr>
    </table>
</fieldset>
<fieldset>
    <legend>Application Information</legend>
    <table class="wide">
        <tr>
            <td width="150px"><?php echo $form->label('CusProductSite.mc', 'M/C') ;?></td>
            <td width="330px"><?php echo !empty($this->data['CustProductSite']['mc'])? $this->data['CustProductSite']['mc']: '-' ?></td>
            <td width="150px"><?php echo $form->label('CusProductSite.fluid') ;?></td>
            <td><?php echo !empty($this->data['CustProductSite']['fluid'])? $this->data['CustProductSite']['fluid']: '-' ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('CusProductSite.temp') ;?></td>
            <td><?php echo !empty($this->data['CustProductSite']['temp'])? $this->data['CustProductSite']['temp']: '-' ?> Celsius</td>
            <td><?php echo $form->label('CusProductSite.pressure') ;?></td>
            <td><?php echo !empty($this->data['CustProductSite']['pressure'])? $this->data['CustProductSite']['pressure']: '-' ?> Psi.</td>
        </tr>
    </table>
</fieldset>
<fieldset>
    <legend>Moving Information</legend>
    <table>
        <tr>
            <td width="200px"><?php echo $form->label('CusProductSite.critical_part'); ?></td>
            <td width="50px" class="text-right"><?php echo ($this->data['CustProductSite']['critical_part'])? "Yes" : "No"; ?></td>
            <td width="210px">&nbsp;</td>
            <td width="200px"><?php echo $form->label('CusProductSite.supplier_current_stock', 'Current Stock'); ?></td>
            <td width="50px" class="text-right"><?php echo $this->data['CustProductSite']['supplier_current_stock'] != null? $this->data['CustProductSite']['supplier_current_stock']: '-' ?></td>
            <td><?php echo $this->data['Product']['Unit']['title'] ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('CusProductSite.critical_mc', 'Critical M/C'); ?></td>
            <td class="text-right"><?php echo ($this->data['CustProductSite']['critical_mc'])? "Yes" : "No"; ?></td>
            <td>&nbsp;</td>
            <td><?php echo $form->label('CusProductSite.request_qty', 'Requested Qty.'); ?></td>
            <td class="text-right"><?php echo $this->data['CustProductSite']['request_qty'] != null? $this->data['CustProductSite']['request_qty']: '-' ?></td>
            <td>
                <?php echo $this->data['Product']['Unit']['title'] ?>
            </td>
        </tr>
        <tr>
            <td><?php echo $form->label('CustProductSite.cycle_time'); ?></td>
            <td class="text-right"><?php echo !empty($this->data['CustProductSite']['cycle_time'])? $this->data['CustProductSite']['cycle_time']: 'N/A' ?></td>
            <td>
                <?php if (!empty($this->data['CyclePeriod']['title']) && !empty($this->data['CustProductSite']['cycle_time']))
                    echo $this->data['CyclePeriod']['title'] ?>
            </td>
            <td><?php echo $form->label('CusProductSite.min_stock'); ?></td>
            <td class="text-right"><?php echo !($this->data['CustProductSite']['min_stock'] === null)? $this->data['CustProductSite']['min_stock']: '-' ?></td>
            <td><?php echo $this->data['Product']['Unit']['title'] ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('CusProductSite.shortest_life_cycle'); ?></td>
            <td class="text-right"><?php echo !empty($this->data['CustProductSite']['shortest_life_cycle'])? $this->data['CustProductSite']['shortest_life_cycle']: 'N/A' ?></td>
            <td>
                <?php if (!empty($this->data['ShortestPeriod']['title']) && !empty($this->data['CustProductSite']['shortest_life_cycle']))
                    echo $this->data['ShortestPeriod']['title'] ?>
            </td>
            <td><?php echo $form->label('CusProductSite.max_stock'); ?></td>
            <td class="text-right"><?php echo !($this->data['CustProductSite']['max_stock'] === null)? $this->data['CustProductSite']['max_stock']: '-' ?></td>
            <td><?php echo $this->data['Product']['Unit']['title'] ?></td>
        </tr>
        <tr>
            <td><?php echo $form->label('CusProductSite.maintenance_plan', 'Maintenance plan(every)'); ?></td>
            <td class="text-right"><?php echo !empty($this->data['CustProductSite']['maintenance_plan'])? $this->data['CustProductSite']['maintenance_plan']: '-' ?></td>
            <td>
                <?php if (!empty($this->data['MaintenancePeriod']['title']) && !empty($this->data['CustProductSite']['maintenance_plan']))
                    echo $this->data['MaintenancePeriod']['title'] ?>
            </td>
        </tr>
    </table>
</fieldset>
<fieldset>
    <legend>Barcode</legend>
    <table class="wide">
        <tr>
            <td width="150px">&nbsp;</td>
            <td>
                <?php if (isset($this->data['Product']['has_barcode']) && $this->data['Product']['has_barcode']) : ?>
                <img src="<?php echo "{$this->base}/products/barcode_image/{$this->data['Product']['id']}" ?>" alt="barcode image" />
                <?php else : ?>&nbsp;
                <?php endif; ?>
            </td>
        </tr>
    </table>
</fieldset>
<fieldset>
    <legend>Picture</legend>
    <table class="wide">
        <tr>
            <td class="center">
                <?php if (isset($this->data['Product']['has_picture_1']) && $this->data['Product']['has_picture_1']) : ?>
                <img src="<?php echo "{$this->base}/products/product_image/{$this->data['Product']['id']}/1" ?>" alt="Picture image 1" /><br />
                <?php else : ?>&nbsp;
                <?php endif; ?>
            </td>
            <td class="center">
                <?php if (isset($this->data['Product']['has_picture_2']) && $this->data['Product']['has_picture_2']) : ?>
                <img src="<?php echo "{$this->base}/products/product_image/{$this->data['Product']['id']}/2" ?>" alt="Picture image 2" /><br />
                <?php else : ?>&nbsp;
                <?php endif; ?>
            </td>
        </tr>
    </table>
</fieldset>